#version 300 es

layout(location=0)in vec4 aVerPos;
uniform float aRotRad;//旋转弧度
uniform vec2 aFlipScale;//翻转缩放
out vec2 texPos;

void verbose(){
    gl_Position=aVerPos;
    float sinRad=sin(aRotRad);
    float cosRad=cos(aRotRad);
    vec4 axisVec=vec4(0.0, 0.0, 1.0, 1.0);//绕z轴旋转
    float ax=axisVec.x;
    float ay=axisVec.y;
    float az=axisVec.z;
    mat4 rotMat=mat4(
    cosRad+(1.0-cosRad)*pow(ax, 2.0), (1.0-cosRad)*ay*ax-sinRad*az, (1.0-cosRad)*az*ax + sinRad*ay, 0.0,
    (1.0-cosRad)*ax*ay+sinRad*az, cosRad+(1.0-cosRad)*pow(ay, 2.0), (1.0-cosRad)*az*ay-sinRad*ax, 0.0,
    (1.0-cosRad)*ax*az-sinRad*ay, (1.0-cosRad)*ay*az +sinRad*ax, cosRad+(1.0-cosRad)*pow(az, 2.0), 0.0,
    0.0, 0.0, 0.0, 1.0
    );//旋转矩阵
    texPos=aFlipScale*(aVerPos/2.0*rotMat).xy+0.5;
}

void main() {
    gl_Position=aVerPos;
    float sinRad=sin(aRotRad);
    float cosRad=cos(aRotRad);
    mat4 rotMat=mat4(
    cosRad, -sinRad, 0.0, 0.0,
    sinRad, cosRad, 0.0, 0.0,
    0.0, 0.0, 1.0, 0.0,
    0.0, 0.0, 0.0, 1.0
    );
    texPos=aFlipScale*(aVerPos/2.0*rotMat).xy+0.5;
}
